#include "Public.h"

extern TCB Current_TCB;
extern TCB Next_TCB;

TCB TCB_Task1;
TCB TCB_Task2;
	

void PendSV_Trig(void);
void Usart_Init(void);
void start_first_task(TCB *tcb);

uint32_t Stack[128];
uint32_t Stack2[128];

void Task_1(void *param)
{
	int i=0;
	LED_Init();
	
	while(1)
	{
		GPIOC->ODR ^=(1<<13);
		for(i=0;i<1000000;i++);
	}
	
}

void Task_2(void *param)
{
	int i=0;
	while(1)
	{
		printf("Hello!\n");
		for(i=0;i<1000000;i++);
	}
	
}


int main()
{
	Usart_Init();
	
	Task_Create(&TCB_Task1,Task_1,0,&Stack[127]);
	Task_Create(&TCB_Task2,Task_2,0,&Stack2[127]);
	Current_TCB=TCB_Task1;
	Next_TCB=TCB_Task2;
	
	start_first_task(&Current_TCB);
	SysTick_Init();
	
	while(1)
	{
		
		
	}
}



void SystemInit(void){}
	
	
void SysTick_Handler(void)
{
	PendSV_Trig();
	
}

